package com.tarena.lbs.business.rpc;

import com.tarena.lbs.business.api.BusinessApi;
import com.tarena.lbs.business.api.pojo.BusinessDto;
import com.tarena.lbs.business.dao.mapper.BusinessMapper;
import com.tarena.lbs.business.pojo.po.BusinessPO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class BusinessApiImpl implements BusinessApi {

    @Autowired
    private BusinessMapper businessMapper;

    @Override
    public BusinessDto getBusinessById(Integer businessId) {
        BusinessPO po = businessMapper.selectById(businessId);
        if (po == null) {
            return null;
        }
        BusinessDto dto = new BusinessDto();
        BeanUtils.copyProperties(po, dto);
        return dto;
    }
}